home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / probots.arc / P-ROBOTS.DOC < prev    next >
Text File  |  1991-04-28  |  64KB  |  1,711 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                    P-ROBOTS
  10.  
  11.  
  12.  
  13.                 A Game for IBM and Macintosh PASCAL Programmers
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.                                       By
  21.  
  22.                                 David Malmberg
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.                                 Distributed by
  33.  
  34.                                    Softworks
  35.                                43064 Via Moraga
  36.                       Mission San Jose, California  94539
  37.                                 (415) 659-0533
  38.  
  39.  
  40.                               _______ 
  41.                          ____|__     |  MEMBER
  42.                       --|       |    |------------------- 
  43.                         |   ____|__  |  Association of 
  44.                         |  |       |_|  Shareware 
  45.                         |__|   o   |    Professionals 
  46.                       -----|   |   |--------------------- 
  47.                            |___|___| 
  48.  
  49.  
  50.  
  51.  
  52.                     Copyrighted 1988 -- All Rights Reserved
  53.                                By David Malmberg
  54.  
  55. TABLE OF CONTENTS
  56.  
  57.  
  58.  
  59. P-ROBOTS REGISTRATION/ORDER FORM  . . . . . . . . . . . . . . . . . . . .   ii
  60.  
  61. LICENSE TERMS (Shareware Rules) . . . . . . . . . . . . . . . . . . . . .  iii
  62.  
  63. DISTRIBUTION OF P-ROBOTS BY DISK VENDORS  . . . . . . . . . . . . . . . .   iv
  64.  
  65. P-ROBOTS PRODUCT/TECHNICAL SUPPORT  . . . . . . . . . . . . . . . . . . .    v
  66.  
  67. ACKNOWLEDGEMENTS  . . . . . . . . . . . . . . . . . . . . . . . . . . . .   vi
  68.  
  69. INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    1
  70.  
  71. HARDWARE AND SOFTWARE REQUIREMENTS  . . . . . . . . . . . . . . . . . . .    1
  72.  
  73. FILES ON THE DISK . . . . . . . . . . . . . . . . . . . . . . . . . . . .    1
  74.  
  75. GETTING STARTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    2
  76.  
  77. INVOKING A CONTEST  . . . . . . . . . . . . . . . . . . . . . . . . . . .    3
  78.  
  79. CONTROLLING YOUR ROBOT'S MOVEMENT . . . . . . . . . . . . . . . . . . . .    4
  80.  
  81. ATTACKING OTHER ROBOTS  . . . . . . . . . . . . . . . . . . . . . . . . .    5
  82.  
  83. OTHER SPECIAL P-ROBOTS FUNCTIONS AND PROCEDURES . . . . . . . . . . . . .    7
  84.      TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  85.      DISTANCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  86.      ANGLE_TO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  87.      RANDOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
  88.      TRIG FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
  89.  
  90. INFLICTING DAMAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . .    9
  91.  
  92. PUTTING IT ALL TOGETHER . . . . . . . . . . . . . . . . . . . . . . . . .    9
  93.  
  94. ROBOT PROGRAMMING RULES . . . . . . . . . . . . . . . . . . . . . . . . .   11
  95.  
  96. APPENDIX I: COMPILER ERRORS . . . . . . . . . . . . . . . . . . . . . . .   13
  97.  
  98. APPENDIX II: RUN-TIME ERRORS  . . . . . . . . . . . . . . . . . . . . . .   15
  99.  
  100. APPENDIX III: COMMON PROBLEMS . . . . . . . . . . . . . . . . . . . . . .   16
  101.  
  102. APPENDIX IV: THE P-ROBOTS PASCAL LANGUAGE . . . . . . . . . . . . . . . .   17
  103.  
  104. APPENDIX V: A BLATANT "PLUG" FOR ANOTHER SOFTWORKS PRODUCT  . . . . . . .   18
  105.  
  106. APPENDIX VI: ABOUT THE AUTHOR . . . . . . . . . . . . . . . . . . . . . .   22
  107.  
  108.  
  109.  
  110.  
  111.  
  112.                                        i
  113.  
  114. P-ROBOTS REGISTRATION/ORDER FORM
  115.  
  116.  
  117. Remit to:  Softworks
  118.            43064 Via Moraga
  119.            Mission San Jose, California  94539
  120.  
  121. You can also order by phone using your Mastercard or VISA by dialing (415)
  122. 659-0533, 12:00 noon to 9:00 p.m., PST ONLY, Monday to Friday.
  123.  
  124. P-ROBOTS Registration .................................. @ $ 20.00 ea $______
  125.  
  126.      Registration entitles you to the following:
  127.  
  128.      (1) Notice of all future P-ROBOTS upgrades.
  129.      (2) Latest version of the program, with a collection of the
  130.            most recent and best robots.
  131.      (3) Turbo Pascal source code for P-ROBOTS.
  132.      (4) Turbo Pascal source code for the multi-tasking PASCAL
  133.           compiler used as the basis for developing P-ROBOTS.
  134.      (5) Telephone support from 7:00 to 9:00 PST (M-F).
  135.      (6) A warm glow from having supported at least one of the many
  136.           Shareware products you probably use.
  137.      (7) The P-ROBOTS author's eternal gratitude.
  138.  
  139. Orders are normally shipped by US mail at no additional charge.
  140.  
  141.     For UPS shipment, please add $4.00...................@ $ 4.00 ea $ ______
  142.  
  143.     For shipments outside the United States, please add  @ $ 5.00 ea $ ______
  144.  
  145.                                                           Subtotal   $ ______
  146.  
  147.     (California residents please add 7% sales tax)             Tax   $ ______
  148.  
  149.                                                              TOTAL   $ ______
  150.  
  151. Payment by:    ( ) Check    ( ) MasterCard    ( ) VISA    ( ) Cash
  152.  
  153.  
  154.      Name: _______________________________________________________________
  155.  
  156.   Address: _______________________________________________________________
  157.  
  158.          : _______________________________________________________________
  159.  
  160.     State: ______________________________ Zip:____________________________
  161.  
  162. Day Phone: ____________________________ Eve: _____________________________
  163.  
  164.    Card #: _________________________________ Exp. Date: __________________
  165.  
  166. Signature of cardholder: _________________________________________________
  167.  
  168. Disk Version Desired:  _____ Macintosh   _____ IBM 5 1/4   _____ IBM 3 1/2
  169.  
  170.  
  171.                                       ii
  172.  
  173. LICENSE TERMS (Shareware Rules)
  174.  
  175.  
  176. P-ROBOTS is NOT public domain or free software, but is being distributed as
  177. "Shareware".  This means that if you are a regular user of P-ROBOTS, you
  178. should pay for your copy and become a registered user.  Only from the income
  179. from your registration fees can the author continue to provide product
  180. support, make enhancements to P-ROBOTS, and stay in business.
  181.  
  182. Non-registered users of this software are granted a limited license to make an
  183. evaluation copy for trial use on a private non-commercial basis, for the
  184. express purpose of determining whether P-ROBOTS is suitable for their needs. 
  185. At the end of this trial period, the user should either register his/her copy
  186. of P-ROBOTS or discontinue using it.
  187.  
  188. Registered users of P-ROBOTS may use P-ROBOTS on any computer, provided that
  189. P-ROBOTS is used on only one computer at a time, and that the copy is not
  190. routinely used on that computer by other people.  If other people use the copy
  191. of P-ROBOTS routinely, they should become registered users themselves. 
  192.  
  193. Registered P-ROBOTS users may make archival and working copies of the P-ROBOTS
  194. program disk to back up their software and protect their investment.  They may
  195. also make evaluation copies of P-ROBOTS for trial use by non-registered users,
  196. subject to the terms outlined above.
  197.  
  198. Operators of electronic bulletin boards (Sysops) are encouraged to post 
  199. P-ROBOTS and related ROBOT game files for downloading by their users.
  200.  
  201. This license to use P-ROBOTS does NOT include the right to distribute or sell
  202. P-ROBOTS.  Distribution terms are detailed below.
  203.  
  204. P-ROBOTS may be uploaded to and downloaded from commercial systems such as
  205. CompuServe, the Source, and BIX, so long as the only charge paid by the
  206. subscriber is for on-line time and there is no charge for the program.  Those
  207. copying, sharing, and/or electronically transmitting the program are required
  208. not to delete or modify the copyright notice and restrictive notices from the
  209. program or documentation; anyone doing so will be treated as a contributory
  210. copyright violator.
  211.  
  212. The P-ROBOTS documentation may not be modified by users. The program may not
  213. be separated from the documentation when distributed.  Printed or "Xeroxed"
  214. copies of the P-ROBOTS documentation (i.e., this manual) may not be
  215. distributed or sold without the written permission of Softworks.
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.                                       iii
  231.  
  232. DISTRIBUTION OF P-ROBOTS BY DISK VENDORS
  233.  
  234.  
  235. Distributors of "public domain" or user-supported software libraries must
  236. obtain written permission to distribute copies of P-ROBOTS and related robot
  237. game files.  No one may use P-ROBOTS as a promotion for any commercial venture
  238. or as an enticement for the user to pay for any program, product, or service
  239. unless they have received the express written permission of the program's
  240. author.
  241.  
  242. In order to distribute P-ROBOTS, a dealer or disk vendor must comply with the
  243. following conditions:
  244.  
  245.      (1)  You must obtain written permission from Softworks to distribute 
  246.           P-ROBOTS.  If you receive no reply, write again: our silence does
  247.           NOT constitute permission, and you may not distribute "pending"
  248.           receipt of permission.
  249.  
  250.      (2)  A fee of not more than $7 may be charged for each disk sold.
  251.           P-ROBOTS may not be included on any disk sold for more than $7,
  252.           including CD-ROM or optical disks, without express written
  253.           permission from Softworks.
  254.  
  255.      (3)  Vendors may not modify or delete ANY files on the disk.  Vendors may
  256.           add a "GO" program, and/or a reasonable number of small text files
  257.           designed to assist or provide a service to the user, but these added
  258.           files must be easily identifiable and end-users must be allowed to
  259.           delete the added files.
  260.  
  261.      (4)  Vendors must make a reasonable effort to distribute only the most
  262.           recent versions of P-ROBOTS.  All vendors who have requested and
  263.           received written permission to distribute P-ROBOTS will be notified
  264.           of updates as they are released.
  265.  
  266.      (5)  All disk vendors must comply with any and all vendor guidelines or
  267.           vendor requirements set forth by the Association of Shareware
  268.           Professionals (ASP); for more information about ASP, contact its
  269.           chairman, Jim Button, at Buttonware in Seattle.  Violation of any
  270.           ASP guideline or requirement automatically revokes permission to
  271.           distribute P-ROBOTS.
  272.  
  273. Until formal requirements are adopted by the ASP, you must comply with the
  274. following guidelines: Vendors must make an attempt to educate users on the
  275. nature of Shareware.  Catalogs, advertisements, order forms, and all disks
  276. sold should contain ASP-approved or recommended wording describing the nature
  277. of shareware, and should explicitly state that no part of disk sale revenues
  278. are paid to the programs' authors.  When vendor catalogs or advertisements
  279. carry both Shareware and PD programs, the Shareware programs must be
  280. differentiated from the public domain programs in some way (in the
  281. description, with an asterisk, by listing the registration fee, etc.).
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.                                       iv
  290.  
  291. P-ROBOTS PRODUCT/TECHNICAL SUPPORT
  292.  
  293.  
  294. Softworks will make every reasonable effort to fix P-ROBOTS bugs, and help
  295. registered users by answering technical and other P-ROBOTS related questions. 
  296. This Product/Technical support for P-ROBOTS is available to registered users
  297. (only) in several forms:
  298.  
  299.      (1)  By leaving a message in the 'Softworks' forum on BIX (the BYTE
  300.           Information Exchange).
  301.  
  302.      (2)  By telephone to David Malmberg at Softworks, Monday through Friday
  303.           from 7:00 PM to 9:00 PM (Pacific Coast Time) at (415) 659-0533.
  304.           Please respect these hours!
  305.  
  306.      (3)  By CompuServe E-Mail to David Malmberg, CompuServe ID 73435,1277.
  307.  
  308.      (4)  By letter to:
  309.  
  310.                     Softworks
  311.                     43064 Via Moraga
  312.                     Mission San Jose, California
  313.                                         94539
  314.  
  315.           If you send disks or listings that you wish returned, be sure to
  316.           enclosed a self-addressed, stamped envelope (SASE) with sufficient
  317.           postage.  If you do not enclose a SASE, your material will not be
  318.           returned.
  319.  
  320. Regardless of the method you use to solicit P-ROBOTS support, if you are
  321. having a problem and you can not get P-ROBOTS to do what you think it should
  322. do, please provide background information on the following:
  323.  
  324.      (1)  The version of P-ROBOTS you are using.
  325.  
  326.      (2)  The computer system you are using.
  327.  
  328.      (3)  Your system's configuration, i.e., amount of RAM, number and type of
  329.           disk drives, the type of monitor you are using.
  330.  
  331.      (4)  Any memory resident programs you have installed at the same time you
  332.           are using P-ROBOTS and a "rough idea" of what they do and how much
  333.           memory they take.
  334.  
  335.      (5)  Your problem, i.e., what is happening vs. what you think should be
  336.           happening.
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.                                        v
  349.  
  350. ACKNOWLEDGEMENTS
  351.  
  352.  
  353. P-ROBOTS owes a great deal to many people and to several previous programs.
  354.  
  355. The P-Code PASCAL compiler that was used in P-ROBOTS has a long history.  It
  356. was originally developed and published in 1976 by Nicklaus Wirth, the "father"
  357. of PASCAL.  In 1982, M. Ben-Ari developed and published a book describing how
  358. to make the compiler capable of multi-tasking.  Over the years, this compiler
  359. has been converted to many, many different computers and to many different
  360. dialects of PASCAL.  In 1986, Charles Schoening converted the compiler to
  361. Turbo Pascal version 2.0 on the IBM and released his version to the public
  362. domain.  I have enhanced and converted the compiler to the most recent
  363. releases of Turbo Pascal (version 4.0 and 5.0 for the IBM and compatibles and
  364. version 1.1 for the Macintosh).  This version was then adapted to be the
  365. compiler "engine" for P-ROBOTS.
  366.  
  367. The inspiration for P-ROBOTS and the basic overall design of the program came
  368. from a similar program called C-ROBOTS by Tom Poindexter, which was first
  369. published in 1985.  As might be expected from the name, C-ROBOTS allows the
  370. programmer to design and program his/her robots in the C language, rather than
  371. PASCAL.  If you are interested in C-ROBOTS, Tom is selling it as Shareware for
  372. a $20 registration fee.  The registration fee entitles you to the latest
  373. version of the program, a large collection of excellent robots, and the source
  374. code for the C-ROBOTS (written in C -- of course).  C-ROBOTS can be ordered
  375. from Tom at the following address:
  376.  
  377.           Tom Poindexter
  378.           6864 Amherst Court
  379.           Highlands Ranch, CO
  380.                     80126
  381.  
  382. C-ROBOTS can NOT be ordered from Softworks; it must be ordered from Tom
  383. directly at the above address.
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.                                       vi
  408.  
  409. INTRODUCTION
  410.  
  411.  
  412. P-ROBOTS ("pee-robots") is a game based on computer programming in PASCAL. 
  413. The objective of the game is to design and program a "robot" that can triumph
  414. over similar robots designed and programmed by others in a real-time battle of
  415. wits and flying missiles.  You control your robot by writing a procedure in
  416. PASCAL to specify your robot's behavior and strategy in its efforts to
  417. vanquish up to three other robots in a battle to the death.  A variety of
  418. pre-defined P-ROBOTS PASCAL functions allow your robot to track its position
  419. on the battlefield, monitor its health or damage condition, and calculate the
  420. distance and angle to opponents from its current battlefield position.  Each
  421. robot is equipped with a cannon to fire missiles, and a motorized drive
  422. mechanism to either close in for the kill of a hapless opponent or flee from a
  423. fierce foe.
  424.  
  425. P-ROBOTS is an excellent way for the novice programmer to sharpen his/her
  426. PASCAL skills and have fun at the same time.  However, P-ROBOTS does assumes
  427. that the robot designer/programmer already knows the fundamentals of
  428. programming in PASCAL.
  429.  
  430. For the experienced programmer, P-ROBOTS offers a chance to see just how well
  431. you program in a programming environment where "bad" code can lead to graphic
  432. and ignoble defeat and "brilliant" code can bring triumph and glory.
  433.  
  434.  
  435. HARDWARE AND SOFTWARE REQUIREMENTS
  436.  
  437. If you intend to run P-ROBOTS on an IBM or compatible computer, you will need
  438. at least 256K of memory and DOS 2.1 or later.  Either a color or monochrome
  439. monitor may be used.  If you are using a color monitor, P-ROBOTS will
  440. automatically detect it and use different colors for each robot.  If you are
  441. using a monochrome monitor, P-ROBOTS will display your robots accordingly.
  442.  
  443. If you intend to run P-ROBOTS on a Macintosh, you will need at least 512K of
  444. memory.  The Macintosh version of P-ROBOTS only runs in monochrome mode.
  445.  
  446.  
  447. FILES ON THE DISK
  448.  
  449. You should have the following files on your P-ROBOTS disk:
  450.  
  451.      P-ROBOTS.EXE   The is the main program that is executed whenever you hold
  452.                     a P-ROBOTS contest.
  453.  
  454.      P-ROBOTS.DOC   This file contains the documentation for P-ROBOTS.  It is
  455.                     a text file and can be printed by giving the command at
  456.                     the DOS prompt: TYPE P-ROBOTS.DOC > PRN
  457.  
  458.      PR-DEMO.BAT    This is a tiny batch file that gives a demonstration of a
  459.                     typical P-ROBOTS contest between three robots.
  460.  
  461.      HOTSHOT.PR     This is a file containing the PASCAL source code for a
  462.                     robot named HOTSHOT.  This is the robot that is given as
  463.                     an example later in this manual.
  464.  
  465.  
  466.                                        1
  467.  
  468.      ????????.PR    These are other PASCAL source code files for other robots. 
  469.                     All P-ROBOTS robots MUST have .PR file extensions. 
  470.                     Without this .PR extension, P-ROBOTS will not compile the
  471.                     robot and enter it in any robot contests.
  472.  
  473.  
  474. GETTING STARTED
  475.  
  476. To see a typical P-ROBOTS contest, just execute the batch file PR-DEMO.  What
  477. you will see will be the PASCAL source code for three robots being read from
  478. the disk and compiled by P-ROBOTS.  After being compiled successfully (without
  479. any errors), you will then see a battle between these three robots.  The
  480. battle will last between one and four minutes and you will be able to see the
  481. individual robots move around the battlefield, fire their missiles and get hit
  482. when the missiles explode too near them on the screen.  The screen and the
  483. battlefield will look something like the following:
  484.  
  485.        (x=0,y=999)                        (x=999,y=999)
  486.  
  487.            +------------------------------------+ 1  CHASER
  488.            |                                    |  D% 015   Sc 218
  489.            |                               1    |  Sp 000   Hd 090
  490.            |                          \^/       |  X= 902   Y= 890
  491.         ^  |     (missile exploding) <-#->      | ------------------
  492.         |  |                          /v\       | 2  M66
  493.            |                                    |  D% 050   Sc 275
  494.         Y  |              +        (missiles    |  Sp 100   Hd 180
  495.            |                     +   flying)    |  X=  89   Y= 534
  496.         a  |                                    | ------------------
  497.         x  |   2                                | 3  NINJA
  498.         i  |                                    |  D% 000   Sc 045
  499.         s  |                                    |  Sp 000   Hd 000
  500.            |                 3                  |  X= 423   Y= 350
  501.            |                /                   | ------------------
  502.            |          (robots)                  | 
  503.            |                                    | 
  504.            |                                    | 
  505.            |                                    | 
  506.            |                                    | 
  507.            |                                    | CPU
  508.            +------------------------------------+ Cycles:     34512
  509.  
  510.        (x=0,y=0)           X axis -->     (x=999,y=0)
  511.  
  512. The battlefield is 1000 meters by 1000 meters with the coordinates 0,0 in the
  513. lower left hand corner of the screen.  The border of the battlefield has a
  514. "fence" or "wall" around it which will cause the robots damage if they run
  515. into it.  Hitting a border of the battlefield will also cause your robot to
  516. come crashing to a halt.  On the battlefield, each robot is represented by a
  517. number from 1 to 4.  (There can be at most four robots in any one contest.) 
  518. Flying missiles will be represented on the screen by + symbols, and explosions
  519. by a flurry of lines and corners -- as can be seen above.
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                        2
  526.  
  527. Beside the battlefield are several "status" areas where information about each
  528. robot is displayed.  The number that precedes the robot's name is its symbol
  529. on the screen.  For example, the number 2 represents the robot M66 in the
  530. above display.  The "D%" field shows the percentage of damage that the robot
  531. has incurred so far.  When the damage percentage gets to 100% the robot dies. 
  532. The "Sc" field shows the direction in degrees (from 0 to 359) that the robot's
  533. scanner is currently pointed.  The scanner is used to detect the presence of
  534. enemy robots and to aim missiles at them.  The "Sp" field show the robot's
  535. current speed.  A speed of zero means the robot is standing still and the
  536. maximum speed is 100.  The "Hd" field show the robot's current heading, i.e.,
  537. the direction it is moving.  Like the scanner field, the heading is shown in
  538. degrees from 0 to 359.  The "X=" and "Y=" fields show the robot's current X
  539. and Y coordinates on the battlefield, respectively.  The 
  540. X-axis runs from 0 on the left to 999 on the right side of the battlefield. 
  541. The Y-axis runs from 0 at the bottom on the screen to 999 at the top.
  542.  
  543. All angles/directions in P-ROBOTS are calculated in degrees from 0 to 359
  544. using the traditional compass directions you undoubted learned in Geometry. 
  545. Due east is zero degrees, north is 90 degrees, etc.:
  546.  
  547.            135    90   45
  548.                \  |  / 
  549.                 \ | /
  550.           180 --- x --- 0
  551.                 / | \
  552.                /  |  \ 
  553.            225   270   315
  554.  
  555.  
  556. INVOKING A CONTEST
  557.  
  558. Sooner or later, you are going to get tired just watching the DEMO match and
  559. will want to see contests between other robots - perhaps, even your own robot
  560. creations.  There are two types of contests: single games or matches.  In
  561. single game mode, the game is played with "graphics" where the progress of the
  562. battle can be watched on the screen.  Match play is when you want to run a
  563. series of contests (maybe as many as 100) between the same group of robots to
  564. see what the winning percentages are for each contestant.  Match play does not
  565. display the actual battles, but just shows the summary of wins and loses as
  566. each individual game is played.  Match play is ideal for playing overnight.
  567.  
  568. If you want to stop a P-ROBOTS game (either single game or match), just hit
  569. Control-Break.
  570.  
  571. To run a single game, just give a command at the DOS prompt like:
  572.  
  573.           P-ROBOTS Robot1 Robot2 .. Robot3
  574.  
  575. For example, to run a single game between the robots: NINJA, HOTSHOT, WIMP and
  576. BLASTER you would enter the command:
  577.  
  578.           P-ROBOTS NINJA HOTSHOT WIMP BLASTER
  579.  
  580. Or to run a single game between HOTSHOT and WIMP you would enter the command:
  581.  
  582.           P-ROBOTS HOTSHOT WIMP
  583.  
  584.                                        3
  585.  
  586. It is also possible to test your robot against a "default" robot, named
  587. TARGET, that is built into the P-ROBOTS program.  TARGET just sits in the
  588. center of the battlefield waiting to get shot at.  However, TARGET does shoot
  589. back -- so be warned that beating TARGET is not totally a trivial exercise. 
  590. TARGET is an excellent opponent for testing new robots.  For example, to test
  591. a robot named FRED against TARGET, just give the command:
  592.  
  593.           P-ROBOTS FRED
  594.  
  595. To invoke a series of contest, i.e., match play, append a /MNNN behind the 
  596. normal single play command, where NNN represents the number of games you wish
  597. to play in the match.  For example, /M50 would cause 50 games to be played in
  598. the match and /M100 would cause 100 games to be played.
  599.   
  600. Specifically, to run a match of 20 games between the robots: NINJA, HOTSHOT,
  601. WIMP and BLASTER you would enter the command:
  602.  
  603.           P-ROBOTS NINJA HOTSHOT WIMP BLASTER /M20
  604.  
  605. Or to run a series of 10 games between HOTSHOT and WIMP you would enter the
  606. command:
  607.  
  608.           P-ROBOTS HOTSHOT WIMP /M10
  609.  
  610. IMPORTANT NOTE: The actual files on the disk containing the source code for
  611. the various robots MUST have a .PR file extension.  However, when the game is
  612. invoked, the use of this extension is optional.
  613.  
  614.  
  615. CONTROLLING YOUR ROBOT'S MOVEMENT
  616.  
  617. To move your robot in P-ROBOTS you must use the special procedure "Drive" that
  618. is built into the P-ROBOTS version of the PASCAL language.  The Drive
  619. procedure would be used in your program as:
  620.  
  621.           Drive (degree,speed);
  622.  
  623. This would cause your robot to move in the direction specified by "degree" and
  624. at the speed indicated by the second parameter, "speed".  The direction will
  625. be forced by the Drive procedure to be between 0 and 359 (i.e., degree :=
  626. degree MOD 360;) and the speed will be restricted to between 0 and the maximum
  627. of 100.  Calling the Drive procedure with a speed of zero, will cause your
  628. robot to stop.
  629.  
  630. For example:
  631.  
  632.           Drive(90,100);  (* drive north at top speed *)
  633.           Drive(heading,0); (* slow down and stop *)
  634.  
  635. In an attempt to simulate some degree of reality, a robot's speed does not
  636. change instantly, but rather has to go through periods of acceleration and
  637. deceleration.  For example, to stop a robot traveling at a maximum speed of
  638. 100 will take between 100 and 200 meters.  Conversely, to get up to a speed of
  639. 100 from a standing stop will also take between 100 and 200 meters.
  640.  
  641.  
  642.  
  643.  
  644.                                        4
  645.  
  646. Also, your robot will not be able to "turn on a dime".  You must be moving at
  647. a speed of 50 or less to change directions.  Attempting to turn while going
  648. over 50 will cause your robot's drive motor to "over heat" and your robot will
  649. just coast to a stop on its current heading.
  650.  
  651. To monitor the status of your movement on the battlefield, the P-ROBOTS
  652. version of PASCAL has several special built-in functions.
  653.  
  654. The built-in "Speed" function returns the current speed of your robot (from 0
  655. to 100).  Remember that the value returned by Speed may not always be the same
  656. as the last parameter used in the last call to Drive, because of acceleration
  657. and deceleration.
  658.  
  659. An example of how the Speed function might be used is as follows:
  660.  
  661.      Drive(270,100);        (* start driving, due south *)
  662.      ; ; ;                  (* other instructions *)
  663.      IF Speed = 0           (* check if stopped, i.e., current speed = 0 *)
  664.          THEN Drive(90,20); (* Probably, ran into the south border *)
  665.                             (* Go north at speed of 20 *) 
  666.  
  667. The built-in "Loc_X" and "Loc_Y" functions return your robots X and Y
  668. coordinates on the battlefield, respectively.   The following shows how these
  669. functions might be used:
  670.  
  671.     Drive (45,50);  (* start driving in north-easterly direction *)
  672.     WHILE (Loc_X < 900) AND (Loc_Y < 900) DO Drive(45,50);
  673.       (* i.e., just keep driving until we are close to a border *)
  674.     Drive (45,0);   (* slow down and stop *)
  675.  
  676.  
  677. ATTACKING OTHER ROBOTS
  678.  
  679. The main offensive weapons available to your robot are its scanner and its
  680. cannon.  Both of these weapons are controlled by using special built-in
  681. capabilities of the P-ROBOTS PASCAL language.
  682.  
  683. The scanner is an "electronic eye" that enables your robot to look for enemy
  684. robots in any chosen direction from 0 to 359 degrees.  The scanner has a
  685. maximum resolution of +/- 10 degrees.  This allows your robot to quickly scan
  686. the battlefield at a low resolution, then use finer resolution to pinpoint a
  687. foe's precise position.  The scanner would be accessed by a reference to the
  688. "Scan" function, as follows:
  689.  
  690.           Scan(degree,resolution)  
  691.  
  692. This function invokes the robot's scanner, at the specified degree and
  693. resolution.  This function returns an integer value of 0 if no enemy robots
  694. are within the scan range or a integer value (greater than 0) representing the
  695. distance to the nearest robot in the scan area.  The value passed as the
  696. parameter "degree" will be forced to be in the range 0 to 359.  Likewise, the
  697. "resolution" will be forced to be in the range of +/- 10 degrees.
  698.  
  699.  
  700.  
  701.  
  702.  
  703.                                        5
  704.  
  705. Some examples:
  706.  
  707.     Enemy := Scan(180,10); (* scans the area from 170 to 190 degrees *)
  708.     Dist_To_Foe := Scan(180,2); (* scans the area from 178 to 182 degrees *)
  709.     Target_Range := Scan(90,0); (* scan 90 degrees, with no variance *)
  710.  
  711. Once an enemy robot is found with the scanner, you would use your robot's
  712. cannon to fire a missile at the enemy.  This is done by using P-ROBOTS special
  713. "Cannon" procedure:
  714.  
  715.           Cannon(degree,range);
  716.  
  717. This will fire a missile in the direction specified by the parameter "degree"
  718. and for a distance specified by the value of "range".  Your robot's cannon has
  719. a maximum range of 700 meters.  There are an unlimited number of missiles --
  720. so you need not worry about running out.  However, it will take some time to
  721. reload between firing missiles; so that, the number of missiles in the air at
  722. any one time to limited to two.  The cannon is mounted on an independent
  723. turret, and therefore can fire in any direction, regardless of the robot's
  724. current movement direction.
  725.  
  726. For example, the following "chunk" of code will cause your robot to constantly
  727. scan for enemies and blast away at them as long as they are in sight.  When
  728. they are no longer in sight (or in range), the scanner will move to the next
  729. 20 degree segment of the circle:
  730.  
  731.     Angle := 0; (* initialize to east *)
  732.     REPEAT
  733.       Enemy_Range := Scan(Angle,10); (* Get range to target -- if any *)
  734.       WHILE (Enemy_Range > 40) AND (Enemy_Range <= 700) DO
  735.         BEGIN (* Enemy in sight and in range *)
  736.           Cannon(Angle,Enemy_Range); (* Blast it! *)
  737.           Enemy_Range := Scan(Angle,10); (* Still there? *)
  738.         END;
  739.       Angle := Angle + 20; (* move search to next segment *)
  740.     UNTIL Dead or Winner;
  741.  
  742. The "Dead" and the "Winner" in the UNTIL statement are special pre-defined
  743. Boolean functions in P-ROBOTS.  Dead will have a value of FALSE while your
  744. robot is still alive (i.e., its damage is less than 100%) and TRUE when it
  745. finally dies.  Similarly, Winner will be TRUE if your robot is the last
  746. survivor of the battle and FALSE otherwise.
  747.  
  748. If your robot utilized the basic "Sitting Duck" strategy given above, its
  749. opponents would undoubtedly make short work of it.  To make the strategy a
  750. little smarter, we need some way to determine if we are under attack. 
  751. Fortunately (and not surprisingly), P-ROBOTS has another special function that
  752. can assist us -- the Damage function.  Whenever you use this function in your
  753. code, it will return an integer value of your robot's current damage
  754. percentage.  If this value changes, then we know the robot is under attack and
  755. it probably should run for safety.
  756.  
  757. As an example, let's see how the Damage function could be used to make the
  758. above code a little smarter:
  759.  
  760.  
  761.  
  762.                                        6
  763.  
  764.     Old_Damage := Damage; (* Get initial value of damage *)
  765.     Angle := 0; (* initialize to east *)
  766.     REPEAT
  767.       Enemy_Range := Scan(Angle,10); (* Get range to target -- if any *)
  768.       WHILE (Enemy_Range > 40) AND (Enemy_Range <= 700) DO
  769.         BEGIN (* Enemy in sight and in range *)
  770.           Cannon(Angle,Enemy_Range); (* Blast it! *)
  771.           Enemy_Range := Scan(Angle,10); (* Still there? *)
  772.         END;
  773.       Angle := Angle + 20; (* move search to next segment *)
  774.       IF Damage > Old_Damage THEN
  775.         BEGIN (* Under attack *)
  776.           Old_Damage := Damage; (* Get latest Damage value *)
  777.           Move; (* Get out of here!! *)
  778.         END;
  779.     UNTIL Dead or Winner;
  780.  
  781. The "Move" reference above would call a separate procedure that would move the
  782. robot to another position on the battlefield where it will hopefully be safer. 
  783. This procedure will be given a little latter as another example.
  784.  
  785.  
  786. OTHER SPECIAL P-ROBOTS FUNCTIONS AND PROCEDURES
  787.  
  788.  
  789. TIME
  790.  
  791. The built-in Time function returns the current time as measures by the
  792. P-ROBOTS' CPU cycles.  By using this function, you should be able to calculate
  793. the speed of your enemies.  The value returned by this function is restricted
  794. to being in the range 0 to 32767 and when it gets to 32767 it starts again at
  795. zero.  An example of how you might get this value is as follows:
  796.  
  797.           Start_Time := Time;
  798.  
  799.  
  800. DISTANCE
  801.  
  802. Since your robot will frequently find it useful to be able to calculate
  803. distances from one point on the battlefield to another, P-ROBOTS provides a
  804. built-in function to do it:
  805.  
  806.           Distance(X1,Y1,X2,Y2)
  807.  
  808. would return the integer distance from the point X1,Y1 to the point X2,Y2.
  809.  
  810.  
  811. ANGLE_TO
  812.  
  813. The Angle_To function will return the angle to a point on the battlefield from
  814. your robot's current position.  The value returned will be an integer in
  815. degrees from 0 to 359.  As an example of how both the Distance and Angle_To
  816. functions might be used, consider the following procedure that will move your
  817. robot to the point X,Y on the battlefield:
  818.  
  819.  
  820.  
  821.                                        7
  822.  
  823.     PROCEDURE GoTo(X, Y : Integer);
  824.       (* Go to location X,Y on playing field. *)
  825.     VAR 
  826.       Heading  : Integer;
  827.     BEGIN
  828.       (* Find the heading we need to get to the desired spot. *)
  829.       Heading := Angle_To(X, Y);
  830.  
  831.       (* Keep traveling at top speed until we are within 150 meters. *)
  832.       WHILE (Distance(Loc_X, Loc_Y, X, Y) > 150) DO Drive(Heading, 100);
  833.  
  834.       (* Cut speed, and creep the rest of the way. *)
  835.       WHILE (Distance(Loc_X, Loc_Y, X, Y) > 20) DO Drive(Heading, 20);
  836.  
  837.       (* Stop driving, should coast to a stop. *)
  838.       Drive(Heading, 0); (* I.E., Stop *)
  839.     END; (* GoTo(X,Y) *)
  840.  
  841.  
  842. RANDOM
  843.  
  844. The function Random(limit) returns a random integer between 0 and limit.  As
  845. an example, the following procedure will cause your robot to move to a random
  846. spot on the battlefield:
  847.  
  848.     PROCEDURE Move;
  849.       (* Move to a random spot on the playing field. *)
  850.     VAR 
  851.       x, y       : Integer;
  852.     BEGIN
  853.       x := Random(900) + 50;
  854.       y := Random(900) + 50;
  855.       GoTo(x, y);
  856.     END; (* Move *)
  857.  
  858. Notice that the Move procedure makes use of the GoTo(X,Y) procedure developed
  859. in the previous example.
  860.  
  861.  
  862. TRIG FUNCTIONS
  863.  
  864. P-ROBOTS has several standard Trig functions that will be of value to a clever
  865. robot, specifically:
  866.  
  867.           Sin(degree)    will return the real value of the Sin of an angle of
  868.                          degree where degree is an integer from 0 to 359
  869.  
  870.           Cos(degree)    will return the real value of the Cos of an angle of
  871.                          degree where degree is an integer from 0 to 359
  872.  
  873.           ArcTan(ratio)  will the angle in integer degrees that has a Tan of
  874.                          ratio
  875.  
  876.  
  877.  
  878.  
  879.  
  880.                                        8
  881.  
  882. INFLICTING DAMAGE
  883.  
  884. Your robot can be damaged by only two things: collisions and missiles.  The
  885. level of damage is given by the following table:
  886.  
  887.        2% --   A collision with another robot (both robots in a collision
  888.                receive damage) or one of the battlefield walls.  A collision
  889.                also causes the robot to stop cold, i.e., its speed is reduced
  890.                instantly to 0.
  891.  
  892.        3% --   A missile explodes within a 40 meter radius.
  893.  
  894.        5% --   A missile explodes within a 20 meter radius.
  895.  
  896.       10% --   A missile explodes within a 5 meter radius.
  897.  
  898. Damage is inflicted on ALL robots within these distances.  That means that if
  899. one of your own missiles explodes within 40 meters of your robot, it causes
  900. damage.  Using sloppy programming logic, it is possible for your robot to
  901. commit suicide by firing missiles too close to itself.  For example, your
  902. robot would not last long with this code:
  903.  
  904.                Drive(Angle,100);
  905.                WHILE (Loc_X < 999) DO Cannon(Angle,Scan(Angle,10));
  906.  
  907. Damage is cumulative, and cannot be repaired.  However, a robot does not loose
  908. any mobility, fire potential, etc. at high damage levels.  In other words, a
  909. robot at 99% damage performs equally as well as a robot with no damage. 
  910. However, when the damage level gets to 100% your robot is dead and it is out
  911. of the current competition.
  912.  
  913.  
  914. PUTTING IT ALL TOGETHER
  915.  
  916. Here is a complete sample robot named HotShot:
  917.  
  918.   PROCEDURE HotShot;
  919.   (*
  920.     Author: David Malmberg
  921.  
  922.     Strategy:  Stay in one place.  Find a foe.  Take a shot.
  923.     Keep improving aim and shooting until foe is lost from sights.
  924.     Then move sights (scanning) to adjacent target area.  If
  925.     hit, then move to another random position on playing field.
  926.     If the Robot scans two complete circles (720 degrees) without
  927.     finding a foe in shooting range, move to another spot on the
  928.     field.  (This will avoid "stand-offs" where opponents stay
  929.     just out of range of one another.)
  930.  
  931.     This Robot should be VERY effective against foes which
  932.     are stopped or are moving slowly.  It will be less effective
  933.     against Robots traveling at high speeds.
  934.   *)
  935.  
  936.  
  937.  
  938.  
  939.                                        9
  940.  
  941.   VAR (* HotShot "Global" variables *)
  942.     Angle,       (* Scanning angle *)
  943.     Last_Damage, (* Robot's last damage value *)
  944.     Range,       (* Range/Distance to foe *)
  945.     Sweep,       (* "Sweep count" -- when = 36, have scanned 720 degrees *)
  946.     Delta        (* Scanning arc *)
  947.                  : Integer;
  948.  
  949.  
  950.     PROCEDURE GoTo(X, Y : Integer);
  951.       (* Go to location X,Y on playing field. *)
  952.     VAR 
  953.       Heading  : Integer;
  954.     BEGIN
  955.       (* Find the heading we need to get to the desired spot. *)
  956.       Heading := Angle_To(X, Y);
  957.  
  958.       (* Keep traveling at top speed until we are within 150 meters. *)
  959.       WHILE (Distance(Loc_X, Loc_Y, X, Y) > 150) DO Drive(Heading, 100);
  960.  
  961.       (* Cut speed, and creep the rest of the way. *)
  962.       WHILE (Distance(Loc_X, Loc_Y, X, Y) > 20) DO Drive(Heading, 20);
  963.  
  964.       (* Stop driving, should coast to a stop. *)
  965.       Drive(Heading, 0); (* I.E., Stop *)
  966.     END; (* GoTo(X,Y) *)
  967.  
  968.  
  969.     FUNCTION Hurt  : Boolean;
  970.       (* Checks if Robot has incurred any new damage. *)
  971.     VAR 
  972.       Curr_Damage  : Integer;
  973.       Answer       : Boolean;
  974.     BEGIN
  975.       Curr_Damage := Damage;
  976.       IF Curr_Damage > Last_Damage
  977.         THEN Answer := TRUE
  978.         ELSE Answer := FALSE;
  979.       Last_Damage := Curr_Damage;
  980.       Hurt := Answer;
  981.     END; (* Hurt *)
  982.  
  983.  
  984.     PROCEDURE Move;
  985.       (* Move to a random spot on the playing field. *)
  986.     VAR 
  987.       x, y       : Integer;
  988.     BEGIN
  989.       Sweep := 0; (* Reset Sweep counter to zero. *)
  990.       x := Random(900) + 50;
  991.       y := Random(900) + 50;
  992.       GoTo(x, y);
  993.     END; (* Move *)
  994.  
  995.  
  996.  
  997.  
  998.                                       10
  999.  
  1000.     PROCEDURE Aim( VAR Ang : Integer; VAR Arc : Integer);
  1001.     (*
  1002.       Improve aim by doing a binary search of the target area.
  1003.       I.E., divide the target area in two equal pieces and redefine
  1004.       the target area to be the piece where the foe is found.
  1005.       If the foe is not found, expand the search area to the
  1006.       maximum arc of plus or minus 10 degrees.
  1007.     *)
  1008.     BEGIN
  1009.       (* Divide search area in two. *)
  1010.       Arc := Arc DIV 2;
  1011.       (* Check piece "below" target angle. *)
  1012.       IF Scan(Ang - Arc, Arc) <> 0 
  1013.         (* If foe found, redefine target angle. *)
  1014.         THEN Ang := Ang - Arc 
  1015.         (* If not found, then check piece "above" target angle. *)
  1016.         ELSE IF Scan(Ang + Arc, Arc) <> 0 
  1017.         (* If foe found, redefine target angle. *)
  1018.           THEN Ang := Ang + Arc 
  1019.           ELSE Arc := 10;
  1020.           (* If foe not found in either piece, expand search arc to +/- 10 *)
  1021.      END; (*Aim*)
  1022.  
  1023.  
  1024.   BEGIN (* HotShot Main *)
  1025.     (* Start scanning for foes in center of field. *)
  1026.     Angle := Angle_To(500, 500);
  1027.     Sweep := 0; (* Initialize Sweep counter to zero. *)
  1028.     REPEAT (* Until Dead or Winner *)
  1029.       Delta := 10; (* Start with widest scanning arc. *)
  1030.       Range := Scan(Angle, Delta);
  1031.       WHILE (Range > 40) AND (Range < 701) DO
  1032.         (* Must be far enough away to avoid self-damage. *)
  1033.         BEGIN
  1034.           Sweep := 0; (* Found foe, so reset Sweep to zero *)
  1035.           Aim(Angle, Delta); (* Improve aim. *)
  1036.           Cannon(Angle, Range); (* Fire!! *)
  1037.           Range := Scan(Angle, Delta); (* Is foe still in sights? *)
  1038.         END;
  1039.       Angle := Angle + 20; (* Look in adjacent target area. *)
  1040.       Sweep := Sweep + 1;
  1041.       IF Hurt OR (Sweep = 36) THEN Move;
  1042.       (* If hit or have scanned two full circles, move elsewhere. *)
  1043.     UNTIL Dead OR Winner;
  1044.   END; (* HotShot Main *)
  1045.  
  1046.  
  1047. ROBOT PROGRAMMING RULES
  1048.  
  1049. There are several things in the above example the you should think of as rules
  1050. that your robots should ALWAYS observe.
  1051.  
  1052.           1.   Your robot should be in a "self-contained" PROCEDURE with the
  1053.                following basic structure:
  1054.  
  1055.  
  1056.  
  1057.                                       11
  1058.  
  1059.                PROCEDURE RoboName;
  1060.  
  1061.                  {"Global" Variables}
  1062.  
  1063.                  FUNCTION A;
  1064.                     ....
  1065.                  PROCEDURE B;
  1066.                     ....
  1067.                  FUNCTION Z;
  1068.  
  1069.                BEGIN {RoboName Main}
  1070.                     ....
  1071.                END; {RoboName Main}
  1072.  
  1073.                Failure to follow this basic structure will cause the P-ROBOTS
  1074.                program and your robot to both meet a fiery death.
  1075.  
  1076.           2.   A robot should have its PROCEDURE named exactly the same name
  1077.                as the file with the code for the robot (except for the .PR
  1078.                extension).  I.E., the HotShot robot procedure should be in a
  1079.                file named HOTSHOT.PR.  Again, failure to follow this rule will
  1080.                cause your robot program to crash.
  1081.  
  1082.           3.   In the "main" routine for your robot, you need to have some
  1083.                kind of "infinite" loop that is repeat endlessly.  In the
  1084.                sample robot, HOTSHOT, this loop is the REPEAT ... UNTIL
  1085.                structure:
  1086.  
  1087.                     REPEAT (* Until Dead or Winner *)
  1088.                     ....
  1089.                     UNTIL Dead OR Winner;
  1090.  
  1091.                Another "infinite" loop that would works equally well is:
  1092.  
  1093.                     WHILE (NOT Dead) AND (NOT Winner) DO
  1094.                       BEGIN
  1095.                       ....
  1096.                       END;
  1097.  
  1098.           4.   Your robot source code should be very well documented with
  1099.                comments.
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.                                       12
  1117.  
  1118. APPENDIX I: COMPILER ERRORS
  1119.  
  1120.  
  1121. The PASCAL compiler in P-ROBOTS will report any syntax or logic errors that it
  1122. encounters during the compilation process.  Then the program will terminate
  1123. without playing the game.  A listing of the robot(s) source code with the
  1124. errors marked in the source will then be found in a file named LISTING.TXT on
  1125. the disk/directory where P-ROBOTS is being run.  Because P-ROBOTS is going to
  1126. write to the disk, you must NOT have a "write-protect" tab on the disk or you
  1127. will get a fatal error whenever you try to run the program.  This file should
  1128. be printed out and studied and your corrections made to your robot source
  1129. files.  Do NOT make your corrections on the LISTING.TXT file!  The compiler
  1130. only compiles robot files (i.e., files with a ".PR" extension).
  1131.  
  1132. If your robot(s) source code did not have any errors (that the compiler could
  1133. detect) there will not be a LISTING.TXT file created and the P-ROBOTS program
  1134. will execute normally and the contest between the various robots will be
  1135. played.
  1136.  
  1137. The compiler will report the following errors by number:
  1138.  
  1139.           0.   UNDEFINED IDENTIFIER
  1140.           1.   MULTIPLE DEFINITION OF THIS IDENTIFIER
  1141.           2.   EXPECTED AN IDENTIFIER
  1142.           3.   PROGRAM MUST BEGIN WITH "PROGRAM"
  1143.           4.   EXPECTED CLOSING PARENTHESIS ")"
  1144.           5.   EXPECTED A COLON ":"
  1145.           6.   INCORRECTLY USED SYMBOL
  1146.           7.   EXPECTED IDENTIFIER OR THE SYMBOL "VAR"
  1147.           8.   EXPECTED THE SYMBOL "OF"
  1148.           9.   EXPECTED AN OPENING PARENTHESIS "("
  1149.           10.  EXPECTED IDENTIFIER, "ARRAY" OR "RECORD"
  1150.           11.  EXPECTED AN OPENING BRACKET "["
  1151.           12.  EXPECTED A CLOSING BRACKET "]"
  1152.           13.  EXPECTED ".." WITHOUT INTERVENING BLANKS
  1153.           14.  EXPECTED A SEMICOLON ";"
  1154.           15.  BAD RESULT TYPE FOR A FUNCTION
  1155.           16.  EXPECTED AN EQUAL SIGN "="
  1156.           17.  EXPECTED BOOLEAN EXPRESSION
  1157.           18.  CONTROL VARIABLE OF THE WRONG TYPE
  1158.           19.  MUST BE MATCHING TYPES
  1159.           20.  "OUTPUT" IS REQUIRED IN PROGRAM HEADING
  1160.           21.  THE NUMBER IS TOO LARGE
  1161.           22.  EXPECT PERIOD ".", CHECK BEGIN-END PAIRS
  1162.           23.  BAD TYPE FOR A CASE STATEMENT
  1163.           24.  ILLEGAL CHARACTER
  1164.           25.  ILLEGAL CONSTANT OR CONSTANT IDENTIFIER
  1165.           26.  ILLEGAL ARRAY SUBSCRIPT (CHECK TYPE)
  1166.           27.  ILLEGAL BOUNDS FOR AN ARRAY INDEX
  1167.           28.  INDEXED VARIABLE MUST BE AN ARRAY
  1168.           29.  EXPECTED A TYPE IDENTIFIER
  1169.           30.  UNDEFINED TYPE
  1170.           31.  VAR WITH FIELD SELECTOR MUST BE RECORD
  1171.           32.  EXPECTED TYPE "BOOLEAN"
  1172.           33.  ILLEGAL TYPE FOR ARITHMETIC EXPRESSION
  1173.           34.  EXPECTED INTEGER FOR "DIV" OR "MOD"
  1174.  
  1175.                                       13
  1176.  
  1177.           35.  INCOMPATIBLE TYPES FOR COMPARISON
  1178.           36.  PARAMETER TYPES DO NOT MATCH
  1179.           37.  EXPECTED A VARIABLE
  1180.           38.  A STRING MUST HAVE ONE OR MORE CHAR
  1181.           39.  NUMBER OF PARAMETERS DO NOT MATCH
  1182.           40.  ILLEGAL PARAMETERS TO "READ"
  1183.           41.  ILLEGAL PARAMETERS TO "WRITE"
  1184.           42.  PARAMETER MUST BE OF TYPE "REAL"
  1185.           43.  PARAMETER MUST BE OF TYPE "INTEGER"
  1186.           44.  EXPECTED VARIABLE OR CONSTANT
  1187.           45.  EXPECTED A VARIABLE OR PROCEDURE
  1188.           46.  TYPES MUST MATCH IN AN ASSIGNMENT
  1189.           47.  CASE LABEL NOT SAME TYPE AS CASE CLAUSE
  1190.           48.  ARGUMENT TO STD. FUNCTION OF WRONG TYPE
  1191.           49.  THE PROGRAM REQUIRES TOO MUCH STORAGE
  1192.           50.  ILLEGAL SYMBOL FOR A CONSTANT
  1193.           51.  EXPECTED BECOMES ":="
  1194.           52.  EXPECTED "THEN"
  1195.           53.  EXPECTED "UNTIL"
  1196.           54.  EXPECTED "DO"
  1197.           55.  EXPECTED "TO" OR "DOWNTO"
  1198.           56.  EXPECTED "BEGIN"
  1199.           57.  EXPECTED "END"
  1200.           58.  EXPECTED ID, CONST, "NOT" OR "("
  1201.           59.  "INPUT"  IS REQUIRED IN PROGRAM HEADING
  1202.           60.  ILLEGAL (CONTROL) CHARACTER PRESENT IN SOURCE 
  1203.  
  1204. Not all of the above error messages will be used in P-ROBOTS because the
  1205. compiler has been modified to not allow certain kinds of PASCAL statements. 
  1206. For example, since P-ROBOTS does not allow READs and WRITEs you will not get
  1207. the above error messages that are normally associated with READ and WRITE.  If
  1208. you attempt to READ or WRITE in a P-ROBOTS program you will get an error
  1209. message number zero -- "UNDEFINED IDENTIFIER".
  1210.  
  1211. Also, remember not to use PASCAL "reserved" words as variable or procedure
  1212. names.  I.E., variables named BEGIN, ARRAY, DO, FOR, etc. will cause strange
  1213. error messages.
  1214.  
  1215. On very rare occasions, you may get another kind of compiler error if the
  1216. robots' source code you are currently trying to compile is so "verbose" that
  1217. it causes the one of the compiler's tables to overflow.  When this happens,
  1218. you will be given an error message which identifies which specific table has
  1219. been over flowed.  The limits for these tables are as follows:
  1220.  
  1221.           400    Identifiers (Variables, Constants, Procedure and Function
  1222.                   names)
  1223.           40     Procedures or Functions
  1224.           40     Real Constants
  1225.           60     Arrays
  1226.           7      Levels of "Nested" Procedures or Functions
  1227.           4000   "Compiled" P-Code instructions
  1228.  
  1229. These limits apply to the total number of identifiers (etc.) for all of the
  1230. robots you have in the current contest.
  1231.  
  1232.  
  1233.  
  1234.  
  1235.                                       14
  1236.  
  1237. APPENDIX II: RUN-TIME ERRORS
  1238.  
  1239.  
  1240. It is possible that the P-ROBOTS compiler will detect an error during the
  1241. game.  These are known as "run-time" errors and they will cause the game to
  1242. terminate and an error message to be printed.  The following kinds of
  1243. run-time errors will be caught and reported:
  1244.  
  1245.           1.   DIVIDE BY 0
  1246.  
  1247.                For example, if Delta_X had a value of zero in the following
  1248.                program statement, you would get a "DIVIDE BY 0" error:
  1249.  
  1250.                Target_Angle := ArcTan(Delta_Y/Delta_X);
  1251.  
  1252.           2.   UNDEFINED CASE
  1253.  
  1254.                For example, if the variable X had a value of 12 below you
  1255.                would get an "UNDEFINED CASE" error:
  1256.  
  1257.                CASE X OF
  1258.                     1 : .....
  1259.                     2 : .....
  1260.                     3 : .....
  1261.                     .
  1262.                     .
  1263.                     10 : .....
  1264.                END; {CASE}
  1265.  
  1266.  
  1267.           3.   INVALID INDEX
  1268.  
  1269.                For example, a reference to the tenth element of an array
  1270.                (i.e., Spot[10]) that was only defined to have the elements one
  1271.                through five (i.e., Spot : ARRAY[1..5] OF INTEGER;) would cause
  1272.                an "INVALID INDEX" error.
  1273.  
  1274.           4.   STORAGE OVERFLOW
  1275.  
  1276.                You would only get a "STORAGE OVERFLOW" error if one (or more)
  1277.                of your robots in the current contest was making too many
  1278.                recursive calls to the same procedure or function or was
  1279.                evaluating a large number of very, very complex assignment
  1280.                statements so that the robot's "stack" space was exceeded.  If
  1281.                you get this error, check your overall robot logic -- there
  1282.                must be a better way!
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.                                       15
  1295.  
  1296. APPENDIX III: COMMON PROBLEMS
  1297.  
  1298.  
  1299. If P-ROBOTS is not doing what you think it should do, check for these common
  1300. problems:
  1301.  
  1302.           1.   Leaving a "write-protect" tab on the game disk will cause a
  1303.                fatal crash.  There needs to be a way for the LISTING.TXT file
  1304.                to be written on the disk.
  1305.  
  1306.           2.   Your robot must be a self-contained PASCAL PROCEDURE with the
  1307.                same name as the file (but without the .PR extension).
  1308.  
  1309.           3.   Your robot must have an "infinite" loop in the "main" routine.
  1310.  
  1311.           4.   Don't commit robot "suicide" by firing your cannon for a range
  1312.                of zero.  For example:
  1313.  
  1314.                     Drive(Angle,100);
  1315.                     WHILE (Loc_X < 999) DO Cannon(Angle,Scan(Angle,10));
  1316.  
  1317.                will cause your robot to commit suicide.
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.                                       16
  1354.  
  1355. APPENDIX IV: THE P-ROBOTS PASCAL LANGUAGE
  1356.  
  1357.  
  1358. P-ROBOTS allows a relatively rich subset of the normal PASCAL language.
  1359.  
  1360. Predefined types include REAL, INTEGER, and BOOLEAN.  CONSTants, RECORDs and
  1361. user-defined TYPEs are allowed.  ARRAYs are allowed.
  1362.  
  1363. Comments may be added to a program by enclosing text with braces { }, or (* *)
  1364. pairs.
  1365.  
  1366. Variable and other identifier names may have up to 10 significant characters.
  1367.  
  1368. Arithmetic operators include: +, -, *, /, DIV and MOD.  Comparison operators
  1369. include: >, <, <>, =, <=, and >=.  Boolean operators include: AND, OR, and
  1370. NOT.
  1371.  
  1372. Control statements/structures include:  CASE, FOR-TO-DO, FOR-DOWNTO-DO,
  1373. IF-THEN, IF-THEN-ELSE, REPEAT-UNTIL, and WHILE-DO.
  1374.  
  1375. Functions and Procedures may or may not have parameters.  If a Function or a
  1376. Procedure has parameters, these parameters may be passed by value or by
  1377. reference (i.e., a VAR parameter).  Procedures and Functions may be "nested"
  1378. to a maximum of seven levels.  Recursion is allowed.
  1379.  
  1380. Pre-defined Functions include: TRUE, FALSE, ABS, SQR, ODD, SUCC, PRED, ROUND,
  1381. TRUNC, SIN, COS, EXP, LN, SQRT, ARCTAN, and RANDOM.  All of these Functions
  1382. have the same interpretation in P-ROBOTS as in standard PASCAL, except for the
  1383. various Trig functions which use degrees in P-ROBOTS, rather than radians.
  1384.  
  1385. The following are NOT allowed in P-ROBOTS and will generate error messages: 
  1386. CHAR, STRING, enumerated types, subranges, pointers, variant records, PACKED,
  1387. sets, IN, files, input, output, GET, PUT, READ, WRITE, WITH, LABEL, GOTO.
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.                                       17
  1413.  
  1414. APPENDIX V: A BLATANT "PLUG" FOR ANOTHER SOFTWORKS PRODUCT
  1415.  
  1416.  
  1417. The Adventure Game Toolkit is designed to allow you to create and play your
  1418. own text adventure games.  Once created, your adventure games can be shared
  1419. with and enjoyed by others -- even if they do not have a copy of the Adventure
  1420. Game Toolkit themselves.   
  1421.  
  1422. The Adventure Game Toolkit (AGT) began life as a program by Mark Welch called
  1423. the Generic Adventure Game System (GAGS).  Using GAGS it was possible for the
  1424. non-programmer to develop complete adventure games using a fixed (but
  1425. relatively large) vocabulary of action verbs.  David Malmberg took GAGS and
  1426. made a number of enhancements including the ability to customize the
  1427. vocabulary and to program complex conditional tests and a rich assortment of
  1428. actions and messages using a special metalanguage (designed specifically for
  1429. writing adventure games).  The current Adventure Game Toolkit combines the
  1430. best features of both approaches to enable the user to create two distinct
  1431. levels of adventure games:
  1432.  
  1433.      (1)  Standard Level games that require no programming experience
  1434.           (honestly!), only a fertile imagination.  These Standard Level games
  1435.           follow the original GAGS format and only require that the user
  1436.           generate the game using a word processor or text editor to describe
  1437.           the various locations, objects and results of actions that
  1438.           collectively make up the game.
  1439.  
  1440.      (2)  Professional Level games that also make use of the special adventure
  1441.           game metalanguage to create games as complex and rich as the game
  1442.           designer's imagination and prose style will allow.  These games
  1443.           should be technically comparable with the published text adventure
  1444.           games from firms like Infocom.
  1445.  
  1446.  
  1447. FEATURES OF THE ADVENTURE GAME TOOLKIT
  1448.  
  1449. AGT has a number of features that make it a very comprehensive adventure
  1450. product.  These features make AGT more powerful, more professional and easier
  1451. to use than any previously available text adventure game development system. 
  1452. Some of these key features are: 
  1453.  
  1454.      POWERFUL
  1455.  
  1456.           *    Big, complex games with up to 200 locations, 100 inanimate
  1457.                objects (e.g., treasures, swords, lakes, trees, books, etc.)
  1458.                and 100 animate objects (e.g., people, animals or creatures).
  1459.  
  1460.           *    Large standard vocabulary with potential to define many more
  1461.                words unique to a specific adventure.  Typical games can have a
  1462.                vocabulary of 400 words or more.
  1463.  
  1464.           *    Sophisticated parser that can understand (1) complex input
  1465.                commands including pronouns (IT, HIM, HER, THEM, MY and ITS),
  1466.                and (2) compound commands separated by AND or THEN or
  1467.                punctuation symbols, and (3) commands addressed to characters
  1468.                within the game.  Here are a few examples of commands AGT can
  1469.                handle with ease:
  1470.  
  1471.  
  1472.                                       18
  1473.  
  1474.                     GET THE FLASH LIGHT AND THEN SWITCH IT ON
  1475.                     DROP THE FOOD, THE KEY AND THE BOTTLE THEN UNLOCK THE DOOR
  1476.                          WITH THE BRASS KEY AND THEN LEAVE
  1477.                     PUT ON THE CLOAK, THEN EXAMINE IT; READ ITS LABEL
  1478.                     PLACE THE GREEN ROCK AND THE SMALL PEBBLE BEHIND THE TREE
  1479.                     ENTER THE HOUSE; GET ALL; EXIT; SOUTH; SOUTH THEN DOWN
  1480.                     SULU, SET A COURSE FOR ALPHA 14
  1481.                     SCOTTY, BEAM DOWN A TRICORDER AND THE QWERTY MODULE
  1482.  
  1483.          *     Special, English-like metalanguage (especially developed for
  1484.                writing Adventure games) that gives the game designer total
  1485.                control and flexibility in the development of his/her games.
  1486.  
  1487.          *     Source code available to Registered Users.  Over 10,000 lines
  1488.                of Turbo Pascal 4.0/5.0 that may be customized to fit the game
  1489.                designer's unique needs. 
  1490.  
  1491.      PROFESSIONAL
  1492.  
  1493.          *     "Look and feel" of Infocom adventure games with similar screen
  1494.                layout and standard vocabulary and routines.
  1495.  
  1496.          *     Automatic screen adaptation to use either a color or a
  1497.                monochrome monitor.  Color combinations may be specified by the
  1498.                game designer or by the player during the game.
  1499.  
  1500.          *     Predefined function and cursor keys to input frequently used
  1501.                commands and move directions.
  1502.  
  1503.          *     SCRIPT and UNSCRIPT commands to echo game output to printer.
  1504.  
  1505.      EASY-TO-USE
  1506.  
  1507.          *     Large library of completed games that can be enjoyed simply as
  1508.                great entertainment or used as a platform by the game designer
  1509.                to build upon and/or learn from.
  1510.  
  1511.          *     Professionally written documentation totalling about 200 pages. 
  1512.                Has numerous examples that unveil the "secrets" of great
  1513.                adventure writers.
  1514.  
  1515.          *     Total compatibility with GAGS and its sizeable collection of
  1516.                games.  
  1517.  
  1518.  
  1519. HARDWARE REQUIREMENTS FOR AGT 
  1520.  
  1521. The games created by the Adventure Game Toolkit requires a computer with at
  1522. least 384K of memory, MS-DOS 2.1, and at least one disk drive.  It is possible
  1523. to use any kind of monitor and AGT will automatically adjust its output to
  1524. best suit the monitor.
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.                                       19
  1532.  
  1533. HOW TO GET A COPY OF THE ADVENTURE GAME TOOLKIT
  1534.  
  1535. The Adventure Game Toolkit (AGT) is distributed as "Shareware".  Copies can be
  1536. found on many electronic bulletin boards and time-sharing services including
  1537. Genie, CompuServe, Source and BIX.  AGT is also available by mail directly
  1538. from the authors at:
  1539.  
  1540.              Softworks 
  1541.              43064 Via Moraga 
  1542.              Mission San Jose, California  94539 
  1543.  
  1544. You can also order by phone using your Mastercard or VISA to (415) 659-0533,
  1545. 12:00 Noon to 9:00 PM, PST ONLY. 
  1546.  
  1547. The price list for various versions/options of AGT is as follows: 
  1548.  
  1549. 1.  AGT Registration .............................. @ $ 20.00 ea  $ ______ 
  1550.      includes: (1) Notice of all future AGT upgrades, new AGT
  1551.      Adventures and related AGT products.  (2) Latest version
  1552.      of the program, sample Adventure game source files (CAVE,
  1553.      CRUSADE, UNDERGRD, ALICE and others), and summary 
  1554.      documentation on disk.  Over one megabyte of program and
  1555.      data files -- ARCed on two disks.  Normally, these disks
  1556.      will not be sent until the next AGT upgrade.  If you wish 
  1557.      these disks sent immediately, please indicate so in your
  1558.      letter or call.  (3) Telephone support from 7:00 to 9:00 
  1559.      PST (M-F).  (4) A warm glow from having supported at least
  1560.      one of the many Shareware products you probably use.  (5)
  1561.      The AGT authors' eternal gratitude. 
  1562.  
  1563. 2.  Above with printed AGT manual ................. @ $ 35.00 ea  $ ______
  1564.      includes: Above items plus printed manual about 200 pages 
  1565.      long with numerous detailed examples on how to use the
  1566.      Adventure Game Toolkit to create very professional and very
  1567.      clever Adventure games.  The printed AGT manual has 
  1568.      approximately 150% the amount of information as contained in
  1569.      the summary disk documentation. 
  1570.  
  1571. 3.  Printed AGT manual (Only) ..................... @ $ 20.00 ea  $ ______  
  1572.  
  1573. 4.  UPGRADE to the newest AGT version (Only) ...... @ $ 12.00 ea  $ ______
  1574.      includes: Latest version of the program, sample Adventure 
  1575.      game source files (CAVE, CRUSADE, UNDERGRD, ALICE and others),
  1576.      and summary documentation on disk.  Over one megabyte of
  1577.      program and data files -- ARCed on two disks. 
  1578.  
  1579. 5.  AGT Turbo Pascal 4.0 source code .............. @ $ 50.00 ea  $ ______
  1580.      includes: Turbo Pascal 4.0 source code for AGT's COMPILE
  1581.      and RUN programs.  Over 10,000 lines of Turbo Pascal source
  1582.      code.  YOU MUST BE A REGISTERED AGT USER TO ORDER THE 
  1583.      SOURCE CODE! 
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.                                       20
  1591.  
  1592.     Orders are normally shipped by US mail at no additional charge. 
  1593.  
  1594.     For UPS shipment, please add $4.00................@ $ 4.00 ea $ ______ 
  1595.  
  1596.     For shipments outside the United States, please add @ $ 5.00  $ ______ 
  1597.  
  1598.                                                         Subtotal  $ ______ 
  1599.  
  1600.     (California residents please add 7% sales tax)           Tax  $ ______ 
  1601.  
  1602.                                                            TOTAL  $ ______ 
  1603.  
  1604.  
  1605. Payment by:    ( ) Check    ( ) MasterCard    ( ) VISA    ( ) Cash
  1606.  
  1607.  
  1608. Be sure to specify the computer/disk version desired:
  1609.  
  1610.             _____ Macintosh   _____ IBM 5 1/4   _____ IBM 3 1/2
  1611.  
  1612.  
  1613.  
  1614.      Name: _______________________________________________________________
  1615.  
  1616.   Address: _______________________________________________________________
  1617.  
  1618.          : _______________________________________________________________
  1619.  
  1620.     State: ______________________________ Zip:____________________________
  1621.  
  1622. Day Phone: ____________________________ Eve: _____________________________
  1623.  
  1624.    Card #: _________________________________ Exp. Date: __________________
  1625.  
  1626. Signature of cardholder: _________________________________________________
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.                                       21
  1650.  
  1651. APPENDIX VI: ABOUT THE AUTHOR
  1652.  
  1653.  
  1654. David Malmberg has been active in the world of personal computer since 1977. 
  1655. He is the author or co-author of six published software products.
  1656.  
  1657. His most successful products were the Turtle Graphics series published by
  1658. HESware.  These two programs have sold over 80,000 copies world-wide, been
  1659. translated into Spanish, and won two Consumer Electronic Software Showcase
  1660. awards as some of the best software of 1983.  These programs are widely used
  1661. in schools to teach computer literacy to children and other computer novices.
  1662.  
  1663. His most recent software product was the Adventure Game Toolkit written with
  1664. Mark Welch.  The Adventure Game Toolkit is also available from Softworks.
  1665.  
  1666. Dave has also published numerous articles and programs in various computer
  1667. magazines.  He has been a Contributing Editor of both COMPUTE!'s HOME &
  1668. EDUCATIONAL COMPUTING and MICRO magazines.  He was one of the principal
  1669. authors of COMPUTE!'s FIRST BOOK OF VIC, the best selling computer book of
  1670. 1983.  He has written regular columns on educational uses of computers and on
  1671. LOGO for COMMODORE and POWER/PLAY magazines.
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.                                       22
  1710.  
  1711.